assume cs:code, es:data

data segment
    a db 1,2,3,4,5,6,7,8
    b dw 0
data ends

code segment
    start:mov ax, data
          mov ds,ax ;  编译出来的指令默认段地址都在ds中，而实际要访问的段为data，故将data的段地址放入ds中
          mov si, 0
          mov cx, 8
        s:mov al, a[si]
          mov ah, 0
          add b, ax
          inc si
          loop s

          mov ax, 4c00h
          int 21h

code ends
end start
